﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VerficationsWPF.Verifications;

namespace VerficationsWPF
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void btnReturnedTaskWindow_Click(object sender, RoutedEventArgs e)
        {
            TaskWindow tw = new TaskWindow();
            tw.MainTask = new Func<object>(() =>
            {
                Thread.Sleep(5_000);
                return 0;
            });
            tw.ShowDialog();

            if (tw.Result is int v)
            {
                Debug.WriteLine(v);
            }
            else
            {
                Debug.WriteLine(tw.ExitMessage);
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void btnAsyncTasRunWindow_Click(object sender, RoutedEventArgs e)
        {
            new AsyncTasRunWindow().ShowDialog();
        }
    }
}
